import axios from './axios'
import qs from 'qs'
import { baseUrl } from '@/config/config'

export const optStop = (data) => {
  return new Promise((resolve, reject) => {
    axios({
      url: baseUrl + '/sign/course/opt/stop',
      method: 'POST',
      data
    }).then(res => {
      resolve(res.data)
    }).catch(error => {
      reject(error.data)
    })
  })
}

export const optRestart = (data) => {
  return new Promise((resolve, reject) => {
    axios({
      url: baseUrl + '/sign/course/opt/restart',
      method: 'POST',
      data
    }).then(res => {
      resolve(res.data)
    }).catch(error => {
      reject(error.data)
    })
  })
}

export const optList = (params) => {
  return new Promise((resolve, reject) => {
    axios({
      url: baseUrl + '/sign/course/opt/listByState',
      method: 'get',
      params
    }).then(res => {
      resolve(res.data)
    }).catch(error => {
      reject(error.data)
    })
  })
}
